package com.data
{
	import com.AppConfing;
	import com.managers.AssetLoadManager;
	
	import flash.filesystem.File;
	import flash.utils.Dictionary;
	
	import mx.controls.Alert;

	public class BaseUIData
	{
		private static const BASEUIFILE_URL : String = "/assets/baseUI";	//	编辑器用图标文件夹路径
		private static var assetsload : AssetLoadManager;
		private static var _uie : UIEditor;
		
		public function BaseUIData()
		{
		}
		
		/**
		 * 初始化基礎界面資源 
		 * 
		 */		
		public static function Init(uie : UIEditor) : void
		{
			_uie = uie;
			
			var str : String = AppConfing.SwfUrl + BASEUIFILE_URL;
			var f : File = new File(str);
			assetsload = new AssetLoadManager();
			assetsload.enqueue(f);
			assetsload.loadQueue(onprogress);
		}
		
		/**
		 * 加载编辑器组件图标的文件夹资源。 
		 * @param ratio
		 * 
		 */		
		private static function onprogress(ratio : Number) : void
		{
			var value : Number = ratio * 100;
			value = Math.round(value);
			_uie.loadprogressBar.setProgress(value,100);
			_uie.loadprogressBar.label = "加载界面资源 "+value+"%";
			if(ratio == 1)
			{
				_uie.maskgroup.visible = false;
				Alert.show("基础界面资源加载完成！","资源加载");
			}
		}
		
		/**
		 * 获取基础界面资源里的bitmap 
		 * @return 
		 * 
		 */		
		private static function get bitmapDict() : Dictionary
		{
			return assetsload.bitmapDict;
		}
	}
}